Component({
	data: {
		active: 0,
		list: [
			{
				icon: 'home-o',
				text: '产品',
				url: '/pages/index/index'
			},
			{
				icon: 'contact-o',
				text: '公司介绍',
				url: '/pages/me/me'
            },
            {
				icon: 'phone-o',
				text: '联系我们',
				url: '/pages/photo/photo'
			}
		]
	},

	methods: {
		onChange(event) {
            this.setData({ active: event.detail });
            console.log(   '跳转',    this.data.list[event.detail].url )
			wx.switchTab({
				url: this.data.list[event.detail].url
			});
		},

		init() {
            const page = getCurrentPages().pop();
            this.data.list.findIndex(item => item.url === `/${page.route}`)
			this.setData({
				active: this.data.list.findIndex(item => item.url === `/${page.route}`)
            });
            console.log(this.data.active)
		}
	}
});
